﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.DAL;
using SES.CMS.BL;
using System.Data;
using SES.CMS.DO;

namespace SES.CMS.Module
{
    public partial class ucModuleRightCate : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            { rptModuleRightCateTopDataSource(); }
        }
        protected void rptModuleRightCateTopDataSource()
        {
            DataTable dtRightCate = new cmsArticleBL().BindToModuleHomepage(3,5);
            if (dtRightCate.Rows.Count > 0)
            {
                rptModuleRightCate.DataSource = new DataView(dtRightCate,"STT=1","",DataViewRowState.CurrentRows);
                rptModuleRightCate.DataBind();
                rptOtherRightCate.DataSource = new DataView(dtRightCate, "STT>1", "", DataViewRowState.CurrentRows);
                rptOtherRightCate.DataBind();

            //    hplMore.NavigateUrl = "/Kinh-doanh/Category/26/Default.aspx";
            }
        }
        protected string FriendlyUrl(string s)
        {
            return Ultility.Change_AV(s);
        }

        public string FriendlyUrl2(string s)
        {
            return Ultility.Change_AV2(s);
        }

        public string CategoryTitle(string CategoryID)
        {
            string CategoryTitle = "";
            CategoryTitle = FriendlyUrl2(new cmsCategoryBL().Select(new cmsCategoryDO { CategoryID = int.Parse(CategoryID) }).Title);
            return CategoryTitle;
        }
    }
}